package br.com.linkcom.sined.geral.bean;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import br.com.linkcom.neo.authorization.Role;
import br.com.linkcom.neo.authorization.impl.AbstractPermission;

@Entity
public class Permissao extends AbstractPermission  {

	protected Integer cdpermissao;
	protected Papel papel;
	protected Tela tela;
	protected String stringpermissao;

	@Id
	public Integer getCdpermissao() {
		return cdpermissao;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="cdpapel")
	public Papel getPapel() {
		return papel;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="cdtela")
	public Tela getTela() {
		return tela;
	}
	public String getStringpermissao() {
		return stringpermissao;
	}

	public void setCdpermissao(Integer cdpermissao) {
		this.cdpermissao = cdpermissao;
	}
	public void setPapel(Papel papel) {
		this.papel = papel;
	}	
	public void setTela(Tela tela) {
		this.tela = tela;
	}	
	public void setStringpermissao(String stringpermissao) {
		this.stringpermissao = stringpermissao;
	}

	/* API */
	@Override
	public void setPermissionString(String string) {
		this.stringpermissao = string;
	}
	@Override
	@Transient
	public String getPermissionString() {
		return stringpermissao;
	}
	@Transient
	public Role getRole() {
		return papel;
	}
}